﻿@model UserViewModel
@{
    ViewBag.Title = "Kelper - My page";
}

<h2>My page</h2>

@if (Model.Recipes.Any())
{
    <fieldset class="my-recipes">
        <legend>My recipes</legend>
        @foreach (var r in Model.Recipes)
        {
            <div class="recipe">
                @Html.DisplayFor(m => r)
                <div class="actions">
                    @Html.ActionLink("Edit", "edit", "recipe", new { id = r.ID }, new { @class = "action-button" })
                    @using (Html.BeginForm("remove", "recipe", FormMethod.Post, new { @class = "action-button" }))
                    {
                        @Html.AntiForgeryToken()
                        <input name="ID" value="@r.ID" type="hidden" />
                        <input data-confirm="Are you sure you want to delete @r.NiceName?"
                               type="submit" value="Remove" />
                    }
                </div>
            </div>
        }
        @Html.PageLinks(Model.TotalPages, Model.CurrentPage, x => Url.Action("index", x == 1 ? null : new { page = x }))
    </fieldset>
}
<div>
    Not satisfied with Kelper?
    @using (Html.BeginForm("unregister", "user", FormMethod.Post, new { @class = "action-button" }))
    {
        @Html.AntiForgeryToken()
        <input data-confirm="Are you sure you want to unregister?"
               type="submit" value="Unregister by clicking here." />
    }
</div>